<?php
  ini_set('error_reporting', E_ALL&~E_NOTICE);
  
  if (($i_NombreRepetido == "")  and ($i_AsuntoRepetido == "")){
    require("../../configuracion.php");
   $idSysSection = $sectionCampEmail;
    $path = "../../";
   require("../../application-top.php");

    $idSegmento = $_GET['idSegmento'];
    $dt_FechaEnvio = date("d/m/Y");
  }

  // Poner los valores default de remitentes
  if ($st_EmailRemitente == "") { $st_EmailRemitente = $emailRemitente; }
  if ($st_NombreRemitente == "") { $st_NombreRemitente = $emailRemitenteNombre; }
  if ($st_EmailReplyTo == "") { $st_EmailReplyTo = $emailReplyTo; }

?>
<!--//-->
<html>
<head>
  <title><?= $instanciaECRM ?></title>
  <link rel="stylesheet" href="../../styles/style.css" type="text/css">
  <script type="text/javascript" src="../calendar_campanias.js"></script>
  <script type="text/javascript" src="../../scripts/dynlayer.js"></script>

</head>
<body leftmargin="0" class="mainBackground" topmargin="0" marginwidth="0" marginheight="0">
<table width="100" border="0" cellpadding="0" cellspacing="0">
  <tr><td><img src="../../images/headerBar.gif" width="590" height="60" alt=""></td></tr>
  <tr>
    <td><table width="800" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td bgcolor="#FFFFFF" valign="top" height="400">

<script type="text/javascript">
<!--
<?php
  if ($i_NombreRepetido > 0) print "alert('El nombre de la campa&ntilde;a \"" . $st_NombreCorreo . "\" ya existe');";
  if ($i_AsuntoRepetido > 0) print "alert('El asunto de la campa&ntilde;a \"" .  $st_Asunto . "\" ya existe');";
?>

  function enviar() {
     if (confirm('Esta seguro que la informaci&oacute;n ingresada de la campa&ntilde;a de \'' + mail.st_NombreCorreo.value + '\' es correcta?')){
     document.forms[0].submit();
    }
  }
//-->
</script>



<form name="mail" method="POST" action="email-nuevoa1.php" onSubmit="return enviar()">
<input type="hidden" size="40" name="id_TipoCorreo" value="1">
<table border="0" cellpadding="5" cellspacing="0" width="750">
  <tr><td colspan="2"><table border="0" cellpadding="0" cellspacing="0" width="100%">
    <tr><td colspan="2"><img src="images/spacer.gif" height="10" width="1" alt=""></td></tr><tr><td><strong class="pageTitle">Campa&ntilde;as E-mail</strong><br><strong class="pageSubtitle">Nueva Campa&ntilde;a</strong></td><td align="right"><a href="http://www.cacto.com/" target="_blank"><img src="../../images/trademarkCacto.gif" alt="Cacto" border="0"></a><br>
<strong class="systemTitle"><?= $instanciaECRM ?></strong><br>Perfil <strong><?= $PerfilUsuario ?></strong></td></tr>
  </table></td></tr>
  <tr><td>
    <table border="0" cellpadding="5" cellspacing="1" class="mainTableBG">
      <tr class="answerCellBG">
        <td><img src="../../images/icArrowGo.gif" height="13" width="13" alt=""></td>
        <td><a href="email_new.php" target="content">Regresar</a></td>
      </tr>
    </table>
  </td></tr>

  <tr>
  <td valign="top" width="100%">
    <table border="0" cellpadding="0" cellspacing="0" width="550">
      <tr><td>
        <table border="0" cellpadding="5" cellspacing="1" class="mainTableBG">
          <tr><td colspan="2" class="mainTableTitle">Tipo de correo <strong>&Uacute;NICO</strong> con <strong>TEMPLATE</strong></td></tr>
          <tr class="answerCellBG">
                      <td class="conceptCellBG">Nombre de la Campa&ntilde;a de E-mail:</td>
                      <td valign="top"><input type="text" size="40" name="st_NombreCorreo" value="<?= $st_NombreCorreo ?>"></td></tr>
          <tr class="answerCellBG">
                      <td valign="top" class="conceptCellBG">Descripci&oacute;n de la campa&ntilde;a:</td>
                      <td valign="top"><textarea cols="39" rows="5" name="st_Descripcion"><?= $st_Descripcion ?></textarea></td></tr>
          <tr class="answerCellBG"><td class="conceptCellBG">Fecha de env&iacute;o:</td><td valign="top"><input type="text" name="dt_FechaEnvio" size="12" value="<?= $dt_FechaEnvio ?>"> <a href="javascript:cal2.popup();"><img src="../../images/icPopUpCalendar.gif" height="16" width="16" alt="" border="0"></a></td></tr>
          <tr class="answerCellBG"><td valign="top" class="conceptCellBG">Autoriza:</td><td valign="top">
              <select name="id_UsuarioAutoriza">
                <option>-- Seleccione quien autoriza --</option>
<?php
    $query = "select id_SysUser,ltrim(nombre) + ' ' + ltrim(paterno) + ' ' + ltrim(materno) as NombreCompleto from app_SysUsers;";
    $result = mssql_query ($query);
    while ($row = mssql_fetch_object($result)){
      if ($id_UsuarioAutoriza == $row->id_SysUser)
        print "<option value=\"" . $row->id_SysUser . "\" selected>" . $row->NombreCompleto . "</option>\n";
      else
        print "<option value=\"" . $row->id_SysUser . "\">" . $row->NombreCompleto . "</option>\n";
    }
?>

        
              </select>
          </td></tr>
        </table>
      </td></tr>
      <tr><td><img src="../../images/spacer.gif" height="10" width="1" alt=""></td></tr>
      <tr><td>
        <table border="0" cellpadding="5" cellspacing="1" class="mainTableBG">
          <tr class="mainTableBG"><td align="right" class="mainTableTitle"><strong>Para</strong>:</td><td>
              <select name="id_Segmento">
                <option>-- Seleccione segmento --</option>
<?php
    $query = "select id_Segmento,st_Segmento from tbl_SegmentosCRM";
    $result = mssql_query ($query);
    while ($row = mssql_fetch_object($result)){
       if ($row->id_Segmento == $id_Segmento) print "<option value=\"" . $row->id_Segmento . "\" selected>" . html_entity_decode(urldecode($row->st_Segmento)) . "</option>\n";
       else print "<option value=\"" . $row->id_Segmento . "\">" . html_entity_decode(urldecode($row->st_Segmento)) . "</option>\n";
    }
?>
              </select>
          </td></tr>
          <tr class="answerCellBG"><td class="conceptCellBG">Asunto:</td><td><input type="text" size="60" name="st_Asunto" value="<?= $st_Asunto ?>" onBlur="checkSubject();"><div id="txtHint">&nbsp;</div></td></tr>
                <tr class="answerCellBG"><td class="conceptCellBG">De (Nombre Remitente):</td><td><input type="text" size="60" name="st_NombreRemitente" value="<?= $st_NombreRemitente ?>"></td></tr>
                <tr class="answerCellBG"><td class="conceptCellBG">De (E-mail Remitente):</td><td><input type="text" size="60" name="st_EmailRemitente"  value="<?= $st_EmailRemitente ?>"></td></tr>
                <tr class="answerCellBG"><td class="conceptCellBG">Responder a:</td><td><input type="text" size="60" name="st_EmailReplyTo"  value="<?= $st_EmailReplyTo ?>"></td></tr>
                <tr class="answerCellBG"><td class="conceptCellBG">Monitor de la campa&ntilde;a:</td><td><input type="text" size="60" name="st_EmailNotificacion" value="<?= $st_EmailNotificacion ?>"></td></tr>
             
              <tr class="answerCellBG">
                      <td valign="top" class="conceptCellBG">Templete:</td>
                      <td valign="top">
                 <table border="0" cellpadding="0" cellspacing="0" class="answerCellBG">
                         <?php
                           if ($id_Templete == "1") $st_Checked1 = " CHECKED";
                           if ($id_Templete == "2") $st_Checked2 = " CHECKED";
                         ?>
                         <tr><td><input type="radio" name="id_Templete" value="1" <?= $st_Checked1 ?>></td><td>Templete 1</td><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:NewWindow('../../emailing/templates/template1.html','Template1',650,400,'yes')">Ver muestra</td></tr>
                         <tr><td><input type="radio" name="id_Templete" value="2" <?= $st_Checked2 ?>></td><td>Templete 2</td><td>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:NewWindow('../../emailing/templates/template2.html','Template2',650,400,'yes')">Ver muestra</td></tr>
                        </table>

                      </td>
                    </tr>
        </table>
      </td></tr>
      <tr><td><img src="../../images/spacer.gif" height="10" width="1" alt=""></td></tr>
<!--      <tr><td colspan="3">
        <table border="0" cellpadding="5" cellspacing="1" class="mainTableBG">
          <tr class="answerCellBG">
            <td><img src="../../images/icArrowGo.gif" height="13" width="13" alt=""></td>
            <td><a href="javascript:enviar();">Siguiente paso</a>
          </tr>
        </table>
      </td></tr>-->
    </table>
  </td>
  </tr>
</table>
</form>
          </td>
        </tr>
      </table></td>
  </tr>
</table>
<script type="text/javascript">
//<!--
  var cal2 = new calendar1(document.forms['mail'].elements['dt_FechaEnvio']);
  cal2.year_scroll = true;
  cal2.time_comp = false;
//-->
</script>

<br>
<br>
<br>
<table width="750" border="0">
  <tr>
    <td align="right"><span class="copyright"><?= $copyright ?></span></td>
  </tr>
</table>
</body>
</html>
